﻿using hpcpdi.DataAccess.Base;
using hpcpdi.DataAccess.Interface;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace hpcpdi.DataAccess.Impl
{
    public class RanderRepository : IRadarRepository
    {
        private readonly Context _context;
        public RanderRepository(Context context)
        {
            _context = context;
        }
        /// <summary>
        /// 雷达站总数
        /// </summary>
        /// <returns></returns>        
        public int GetRadarCount()
        {
            var total = (from cfg in _context.P4_cfg
                        join p4temp in _context.P4_status_temp
                    on cfg.Id equals p4temp.Id
                        where p4temp.IsConnectedIsConnected == true
                        select new { cfg.Id }
                      ).Count(); ;
            return total;
        }
    }
}
